<?php
use yii\helpers\Url;
\backend\assets\UploadAsset::register($this);
!isset($col_md) && $col_md = 12;
!isset($label_name) && $label_name = "";
!isset($input_value) && $input_value = "";
if ( !isset($pic_view) || !$pic_view ) {
    $pic_view = $input_value ? $input_value : "";
}
!isset($rel_nModule) && $rel_nModule = 0;
!isset($callback_success) && $callback_success = "";
!isset($callback_input) && $callback_input = "pic_input";
!isset($upload_dir) && $upload_dir = "upload";
!isset($ratio) && $ratio = 0;
!isset($to) && $to = null;
!isset($filename) && $filename = '';
!isset($width) && $width = '';
$callback_view = uniqid();
?>
<div class="col-md-<?=$col_md?>">
    <label class="control-label"><?=$label_name?></label>
    <div class="dropify-wrapper form-group" style="height: 275px;" rel-action="open" rel-idx="" rel-mModule="<?=$rel_nModule?>" href="<?=Url::to(['/attachment/cropper', 'to'=>$to,'filename'=>$filename,'width'=>$width,'callback_success'=>$callback_success, 'callback_view' => '#' . $callback_view, 'upload_dir' => $upload_dir, "callback_input" => "#" . $callback_input, "ratio" => $ratio])?>" rel-title="图片上传" rel-height="610px" rel-width="900px">
        <div class="dropify-message">
            <span class="file-icon"></span>
            <p>点击上传图片</p>
            <p class="dropify-error" rel-mark="<?=$callback_input?>"></p>
        </div>
        <div class="dropify-loader"></div>
        <?php if ($pic_view) : ?>
            <div class="dropify-preview" style="display: block;">
        <?php else :?>
            <div class="dropify-preview">
        <?php endif ?>
            <span class="dropify-render">
                <img class="dropify-image" src="<?=$pic_view?>" id="<?=$callback_view?>">
            </span>
            <div class="dropify-infos">
                <div class="dropify-infos-inner">
                    <p class="dropify-filename"><span class="file-icon"></span><span class="dropify-filename-inner"></span></p>
                    <p class="dropify-infos-message">Drag and drop or click to replace</p>
                </div>
            </div>
        </div>
        <input type="hidden" id="<?=$callback_input?>" name="<?=$callback_input?>" value="<?=$input_value?>">
    </div>
</div>
